import java.util.Arrays;
import java.util.Random;

public class Test {
    public static void main4(String[] args) {
        int[] array = {1,3,15,61,17,10};
//        Sort.insertSort(array);
        Sort.sellectSort(array);
        System.out.println(Arrays.toString(array));
    }
    public static void main2(String[] args) {
        int[] array = {1,3,15,61,17,10};
        Sort.shellSort(array);
        System.out.println(Arrays.toString(array));
    }
    public static void initOrder(int[] array) {
        for (int i = 0;i < array.length;i++) {
            array[i] = array.length - i;
        }
    }
    public static void main(String[] args) {
        int[] array = new int[10_0000];
        initOrder(array);
        testInsert(array);
        testShellSort(array);
        testSelect(array);

    }
    public static void testInsert(int[] array) {
        int[] tmpArray = Arrays.copyOf(array,array.length);
        long startTime = System.currentTimeMillis();
        Sort.shellSort(array);
        long endTime = System.currentTimeMillis();
        System.out.println("直接插入排序"+(endTime-startTime));
    }
    public static void testSelect(int[] array) {
        int[] tmpArray = Arrays.copyOf(array,array.length);
        long startTime = System.currentTimeMillis();
        Sort.sellectSort(array);
        long endTime = System.currentTimeMillis();
        System.out.println("选择排序"+(endTime-startTime));
    }
    public static void testShellSort(int[] array) {
        int[] tmpArray = Arrays.copyOf(array,array.length);
        long startTime = System.currentTimeMillis();
        Sort.shellSort(array);
        long endTime = System.currentTimeMillis();
        System.out.println("希尔排序"+(endTime-startTime));
    }
     public static void notOrder(int[] array) {
         Random random = new Random();
         for (int i = 0;i < array.length;i++) {
             array[i] = random.nextInt(10000);
         }
     }
}
